package org.codeblue.support.beans;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;
import java.util.Date;

@SuppressWarnings("serial")
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class DefaultResp<E> implements Serializable {

    private Boolean success;
    private String msg = "";
    private E data;
    private Date time;

    public DefaultResp() {
        success = true;
        time = new Date();
    }

    public DefaultResp(Boolean success) {
        this.success = success;
        time = new Date();
    }

    public DefaultResp(E data) {
        success = true;
        time = new Date();
        this.setData(data);
    }

    public DefaultResp(Boolean success, String msg) {
        setSuccess(success);
        setMsg(msg);
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }
}
